package com.biz;

import java.util.ArrayList;

import com.dao.BeerDAO;
import com.entity.Beer;

public class BeerBiz {

	public int insert(String name, String nation, String type_yn, int price, int stock){
		String bno;
		String t_nation = nation.substring(0, 2).toUpperCase();
		String t_name = name.substring(0, 2).toUpperCase();
		bno = t_nation + "-" + t_name + "-01";
		BeerDAO dao = new BeerDAO();
		return dao.insert(bno, name, nation, type_yn, price, stock);
	}
	
	public int update(String bno, String type_yn, int price, int stock){
		BeerDAO dao = new BeerDAO();
		return dao.update(bno, type_yn, price, stock);
	}
	
	public int delete(String bno){
		BeerDAO dao = new BeerDAO();
		return dao.delete(bno);
	}
	
	public ArrayList<Beer> select(){
		BeerDAO dao = new BeerDAO();
		return dao.select();
	}
	
	public ArrayList<Beer> selectByType(boolean type){
		BeerDAO dao = new BeerDAO();
		return dao.selectType(type);
	}
	
	public Beer selectByID(String b_No) {
		BeerDAO dao = new BeerDAO();
		return dao.selectByID(b_No);
	}
}
